package JDBCDemo;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class JDBCWork {
    public static void main(String[] args) {
        try (
                Connection connection = DBUtil.getConnection();
        ) {
            Statement statement = connection.createStatement();
            String sql ="SELECT name, press, author, price, isbn " +
                        "FROM book";
            System.out.println(sql);
            ResultSet rs = statement.executeQuery(sql);
            while(rs.next()){
                String name = rs.getString("name");
                String press = rs.getString("press");
                String author = rs.getString("author");
                int price = rs.getInt("price");
                int ISBN = rs.getInt("isbn");
                System.out.println(name + " , " + press +" , "+ author + " , " + price + " , " + ISBN);
            }
            rs.close();






















        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
